package Goods;

import java.util.List;

import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.tedu.store.bean.Goods;
import cn.tedu.store.bean.GoodsCategory;
import cn.tedu.store.controller.GoodsController;
import cn.tedu.store.mapper.GoodsCategoryMapper;
import cn.tedu.store.mapper.GoodsMapper;
import cn.tedu.store.service.GoodsService;

public class testGoodsCategory {
	@Test
	public void getGoodsCategoryByParentId(){
		AbstractApplicationContext ac=new ClassPathXmlApplicationContext("spring-dao.xml");
		GoodsCategoryMapper gcm=ac.getBean("goodsCategoryMapper",GoodsCategoryMapper.class);
		List<GoodsCategory> list=gcm.getGoodsCategoryByParentId(161, 1, 3);
		for(GoodsCategory c:list){
			System.out.println(c.getName());
		}
	}
	@Test
	public void getGoodsByCategoryIdtest(){
		AbstractApplicationContext ac=new ClassPathXmlApplicationContext("spring-dao.xml","spring-service.xml","spring-mvc.xml");
		GoodsService gm=ac.getBean("goodsService",GoodsService.class);
		System.out.println(gm.getCountByTitle("联想"));
		
	}
}
